package com.lzw.breezeNovel.webApp.controller.video;

import com.lzw.breezeNovel.common.result.Result;
import com.lzw.breezeNovel.model.entity.pojo.video.PlayRecord;
import com.lzw.breezeNovel.webApp.service.video.PlayRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * @author 清风明月
 * @Package com.lzw.breezeNovel.webApp.controller.video
 * @date 2025/3/19
 * @description 视频播放记录
 */

@RestController
@RequestMapping("/app/video/record")
@SuppressWarnings("all")
public class PlayRecordController {
    /**
     * 注入service
     */
    @Autowired
    private PlayRecordService playRecordService;

    /**
     * 添加播放记录
     * @param playRecord
     * @return
     */
    @RequestMapping("/add")
    public Result add(@RequestBody PlayRecord playRecord){
         playRecordService.addPlayRecord(playRecord);
        return Result.ok();
    }

    /**
     * 获取播放记录
     */
    @RequestMapping("/get")
    public Result<PlayRecord> get(@RequestBody PlayRecord playRecord){
        PlayRecord play = playRecordService.getPlayRecord(playRecord);
        return Result.ok(play);
    }

}
